FROM	ubuntu:20.04
ENV	DEBIAN_FRONTEND=noninteractive
COPY ustc.ubunut.20.04.apt.sources.list /etc/apt/sources.list

RUN apt-get update \
  && apt-get install -y --no-install-recommends dialog apt-utils \
  && echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \
  && apt-get upgrade -y -o Dpkg::Options::="--force-confold"
RUN apt-get install --reinstall ca-certificates -y
RUN apt-get install locales -y
RUN locale-gen zh_CN.UTF-8 &&\
  DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
RUN locale-gen zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN:zh
ENV LC_ALL zh_CN.UTF-8 
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY busybox /bin/busybox

RUN	apt-get -y update \
	&& apt-get -y upgrade \
	&& apt-get -y install software-properties-common curl \
	&& add-apt-repository -y ppa:adiscon/v8-stable \
	&& apt-get -y update \
	&& apt-get -y install libfastjson4 \
	&& apt-get -y install rsyslog \
		rsyslog-elasticsearch \
		rsyslog-imptcp \
		rsyslog-mmjsonparse \
		rsyslog-mmutf8fix \
		rsyslog-relp \
		rsyslog-omstdout \
	&& rm -r /etc/rsyslog.conf
ADD	rsyslog.conf /etc/rsyslog.conf
#VOLUME  /rsyslog-bin
RUN	mkdir /rsyslog-bin \
	&& cp /usr/sbin/rsyslogd /usr/lib/rsyslog/* /rsyslog-bin

EXPOSE	10514

WORKDIR /rsyslog-bin
CMD	["/rsyslog-bin/rsyslogd", "-n", "-f/etc/rsyslog.conf", "-M."]
